<%@page import="model.StudentModel,javax.sql.RowSet"%>

<%
	response.setContentType("text/html");
%>
<%
	String username = request.getParameter("username");
	System.out.println("uname:" + username);

	RowSet crsName = (RowSet) StudentModel.getNameInfo(username);
	crsName.next();

	RowSet crsCoun = (RowSet) StudentModel.getCounInfo(username);
	crsCoun.next();

	int resid = crsCoun.getInt("Residence");
	int citid = crsCoun.getInt("Citizenship");

	RowSet crsResName = (RowSet) StudentModel.getCounName(resid);
	crsResName.next();

	RowSet crsCitName = (RowSet) StudentModel.getCounName(citid);
	crsCitName.next();

	RowSet crsAddr = (RowSet) StudentModel.getAddrInfo(username);
	crsAddr.next();

	RowSet crsSpec = (RowSet) StudentModel.getSpecInfo(username);
	crsSpec.next();

	RowSet crsRev = (RowSet) StudentModel.getRevInfo(username);
	crsRev.next();

	RowSet crsDID = (RowSet) StudentModel.getDegreeID(username);
%>

Name:
<%=crsName.getString("First")%>

<%
	if (!crsName.getString("Middle").equals("")) {
%>
<%=crsName.getString("Middle")%>

<%
	}
%>
<%=crsName.getString("Last")%>

<p>
	Country of Residence:
	<%=crsResName.getString("Country")%>
<p>
	Country of Citizenship:
	<%=crsCitName.getString("Country")%>
	<%
		if (crsResName.getString("Country").equals("United States")) {
	%>

<p>
	Street:
	<%=crsAddr.getString("Street")%>
<p>
	City:
	<%=crsAddr.getString("City")%>
<p>
	State:<%=crsAddr.getString("State")%>
<p>
	Zip Code:<%=crsAddr.getString("Zip")%>
<p>
	Area Code:<%=crsAddr.getString("AreaCode")%>
<p>
	Phone:
	<%=crsAddr.getString("Phone")%>
	<%
		} else {
	%>

<p>
	Street:
	<%=crsAddr.getString("Street")%>
<p>
	City:
	<%=crsAddr.getString("City")%>
<p>
	Country Telephone Code:<%=crsAddr.getString("AreaCode")%>
<p>
	Zip Code:<%=crsAddr.getString("Zip")%>
<p>
	Area Code:<%=crsAddr.getString("AreaCode")%>
<p>
	Phone:
	<%=crsAddr.getString("Phone")%>
	<%
		}
	%>
	<%
		//degreepart
		while (crsDID.next()) {
			RowSet crsDEG = (RowSet) StudentModel.getDegrees(crsDID
					.getInt("DegID"));
			while (crsDEG.next()) {
				RowSet crsSCH = (RowSet) StudentModel.getSchool(crsDEG
						.getInt("School"));
				crsSCH.next();
				RowSet crsMAJ = (RowSet) StudentModel.getMajor(crsDEG
						.getInt("Major"));
				crsMAJ.next();
	%>

<p>
	Location:
	<%=crsSCH.getString("Location")%></p>
<p>
	School:
	<%=crsSCH.getString("University")%></p>
<p>
	Discipline of degree:
	<%=crsMAJ.getString("Discipline")%>
	<%=crsDEG.getString("Title")%></p>
<p>
	Degree earned:
	<%=crsDEG.getString("Month")%>
	<%=crsDEG.getString("Year")%></p>
<p>
	GPA:
	<%=crsDEG.getString("GPA")%></p>
<%
	}
	}
%>
<p>
	Specialization:
	<%=crsSpec.getString("Specialization")%>
<p>
	Grade1:
<%=crsRev.getInt("Grade1")%>
	<%
		if (crsRev.getString("Comment1") != null) {
	%>
	<p>
Comment1:
<%=crsRev.getString("Comment1")%>
	<%
		}
	%>
	<p>
Grade2:
<%=crsRev.getInt("Grade2")%>
	<%
		if (crsRev.getString("Comment2") != null) {
	%>
	<p>
Comment2:<%=crsRev.getString("Comment2")%>
	<%
		}
	%>
	<p>
Grade3:
<%=crsRev.getInt("Grade3")%>
	<%
		if (crsRev.getString("Comment3") != null) {
	%>
	
<p>Comment3:<%=crsRev.getString("Comment3")%>
	<%
		}
	%>